
# Set paths
EXE_DIR = ..\\..\\wsjtx_install
QT_DIR = C:/wsjt-env/Qt5/5.2.1/mingw48_32
FFTW3_DIR = ..

INCPATH = -I${QT_DIR}/include/QtCore -I${QT_DIR}/include 

# Compilers
CC = gcc
CXX = g++
FC = gfortran
AR = ar cr
RANLIB = ranlib
MKDIR = mkdir -p
CP = cp
RM = rm -f

FFLAGS = -O2 -fbounds-check -Wall -Wno-conversion
CFLAGS = -O2 -I. 

# Default rules
%.o: %.c
	${CC} ${CFLAGS} -c $<
%.o: %.f
	${FC} ${FFLAGS} -c $<
%.o: %.F
	${FC} ${FFLAGS} -c $<
%.o: %.f90
	${FC} ${FFLAGS} -c $<
%.o: %.F90
	${FC} ${FFLAGS} -c $<

all:	 jt9w 

OBJS1 = jt9w.o smo.o sync9w.o pctile.o shell.o lorentzian.o fchisq0.o \
      softsym9w.o four2a.o interleave9.o jt9fano.o fano232.o packjt.o \
      deg2grid.o grid2deg.o fmtmsg.o db.o decode9w.o
      
jt9w: $(OBJS1) 
	$(FC) -o jt9w $(OBJS1) -lfftw3f

OBJS2 = t1.o four2a.o db.o
t1:   $(OBJS2)
	$(FC) -o t1 $(OBJS2) -lfftw3f

OBJS3 = t2.o four2a.o db.o
t2:   $(OBJS3)
	$(FC) -o t2 $(OBJS3) -lfftw3f

OBJS4 = t3.o 
t3:   $(OBJS4)
	$(FC) -o t3 $(OBJS4) -L. -ljt9 C:\JTSDK\fftw3f\libfftw3f-3.dll

.PHONY : clean

clean:
	$(RM) *.o JTMSKcode JTMSKcode.exe
